//
//  XWTestViewController.m
//  3D_Touch
//
//  Created by Xie Wei on 2019/7/19.
//  Copyright © 2019 Xie Wei. All rights reserved.
//

#import "XWTestViewController.h"

@interface XWTestViewController ()

@property (nonatomic, strong) UIImageView *imageView;

@end

@implementation XWTestViewController


- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = (self.index == 0 ? [UIColor purpleColor] : [UIColor redColor]);
    self.title = @"二级界面";
    
    [self.view addSubview:self.imageView];
}

- (UIImageView *)imageView {
    if (_imageView == nil) {
        UIImage *image = [UIImage imageNamed:@"girl"];
        CGFloat height = 400.0f;
        CGFloat width = height * image.size.width / image.size.height;
        _imageView = [[UIImageView alloc] initWithImage:image];
        _imageView.frame = CGRectMake(0, 0, width, height);
        _imageView.center = self.view.center;
    }
    return _imageView;
}

- (NSArray<id<UIPreviewActionItem>> *)previewActionItems {
    UIPreviewAction *action1 = [UIPreviewAction actionWithTitle:@"收藏" style:UIPreviewActionStyleDefault handler:^(UIPreviewAction * _Nonnull action, UIViewController * _Nonnull previewViewController) {
        NSLog(@"收藏");
    }];
    
    UIPreviewAction *action2 = [UIPreviewAction actionWithTitle:@"分享" style:UIPreviewActionStyleDefault handler:^(UIPreviewAction * _Nonnull action, UIViewController * _Nonnull previewViewController) {
        NSLog(@"分享");
    }];
    
    NSArray *actions = @[action1,action2];
    
    return actions;
}

@end
